<?php
/**
 * Get the current URL (relative)
 *
 * @package     Visi
 * @subpackage  View Helpers
 * @author      Luke Visinoni <luke.visinoni@gmail.com>
 * @copyright   (c) 2011 Coalition Technologies <joel@coalitiontechnologies.com>
 * @version     $Id$
 */
class Visi_View_Helper_GetUrl extends Zend_View_Helper_Abstract {

    public function getUrl($full = false, $withPath = true, $secure = false) {
    
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $url = '';
        $host = $_SERVER['HTTP_HOST'];
        $path = $request->getPathInfo();
        if ($secure) {
            $scheme = 'https';
        } else {
            $scheme = 'http';
        }
        if ($full) {
            $url = $scheme . '://' . $host;
        }
        if ($withPath) {
            $url .= $path;
        }
        return $url;
    
    }

}